home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format CD 46
/
Amiga Format CD46 (1999-10-20)(Future Publishing)(GB)[!][issue 1999-12].iso
/
-serious-
/
comms
/
www
/
httpresume
/
rexx
/
suffixdownload.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1999-09-06
|
1KB
|
48 lines
/* $VER: SuffixDownload.rexx 1.0 (28.12.98) */
/* by Andrija Antonijevic <TheAntony@bigfoot.com> */
/* Downloads file and appends suffix to its name */
/* until it's completely downloaded. After that, */
/* it restores the original name. */
/* */
/* Start this script when you would otherwise */
/* click on "Start" to download a file. */
OPTIONS RESULTS
Suffix = '.resuming'
SuffixLen = LENGTH(Suffix)
IF ~SHOW('L', 'rexxsupport.library') THEN IF ~ADDLIB('rexxsupport.library', 0, -30, 0) THEN DO
SAY "Couldn't open rexxsupport.library!"
EXIT 10
END
HPort = ADDRESS()
IF (LEFT(HPort, 11) ~= 'HTTPRESUME.') THEN DO
SAY 'This has to be started from HTTPResume!'
EXIT 20
END
QUERY OUTFILE
File = RESULT
QUERY URL
What = RESULT
/* Strip suffix from filename */
IF RIGHT(File, SuffixLen) = Suffix THEN File = LEFT(File, LENGTH(File) - SuffixLen)
SET OUTFILE File || Suffix
SET URL What
START
Working = 1
DO WHILE Working > 0
CALL Delay(150) /* Pause 3 seconds */
QUERY FINISHED
Working = RESULT
END
IF Working = 0 THEN DO /* Downloading finished, no errors */
ADDRESS COMMAND 'C:Rename FROM ' || File || Suffix || ' TO ' || File ' QUIET'
END